package com.example.satoken;

import cn.dev33.satoken.stp.StpUtil;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class IndexController {
    @GetMapping("/login")
    public String login() {
        StpUtil.login(100);
        return "ok";
    }

    @GetMapping("isLogin")
    public String isLogin() {
        return "当前会话是否登录：" + StpUtil.isLogin();
    }

    @GetMapping("loginOut")
    public String loginOut() {
        StpUtil.logout();
        return "ok";
    }
}
